<?php
/**
 * Created by PhpStorm.
 * User: dell
 * Date: 2017/8/2
 * Time: 16:52
 */

namespace Home\Service;


use Common\Common\Service;
use Home\Component\RecordComponent;
use Home\Exception\HomeException;
use Home\Response\GetRecordNumResponse;

class GetRecordNumService implements Service
{
    public function run()
    {
        $component = new RecordComponent();
        $response = new GetRecordNumResponse();
        try {
            $result = $component->getRecordNum();
            if (is_null($result) == true) {
                $response->setItIsNull();
            } else {
                $response->setRecordNum($result);
            }
        } catch (HomeException $e) {
            throw new HomeException($e->getMessage(), $e->getCode());
        }
        return $response;
    }
}